const cirty = ['大庆', '吉林', '辽河', '冀东', '大港', '华北', '长庆', '西南', '青海', '玉门', '吐哈', '新疆', '塔里木', '浙江', '南方', '煤层气', '勘探院', '东方研究院']
export default function getData() {
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: { // 坐标轴指示器，坐标轴触发有效
        type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
      }
    },
    legend: {
      data: cirty,
      bottom: 10,
      left: 30,
      right: 30,
      itemGap: 15,
      itemWidth: 8,
      itemHeight: 8,
      textStyle: {
        color: '#999'
      }
    },
    grid: {
      left: 20,
      top: 20,
      right: 20,
      bottom: 90,
      containLabel: true
    },
    color: ['#3890df', '#00b4ff', '#1b3993', '#00cba7', '#84d478', '#0aa299', '#6e798b', '#c04eee', '#9b00b5', '#682e99', '#f81d56', '#f31111', '#992617', '#f57826', '#f7ac1e', '#d75300', '#95a6a5', '#dfc4e0'],
    yAxis: {
      type: 'value',
      axisLine: {
        show: false
      },
      axisLabel: {
        color: '#999'
      },
      axisTick: {
        show: false
      },
      splitLine: {
        lineStyle: {
          type: 'dotted'
        }
      }
    },
    xAxis: {
      type: 'category',
      axisLine: {
        show: false
      },
      axisLabel: {
        color: '#999'
      },
      axisTick: {
        show: false
      },
      data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月']
    },
    series: getSeries(cirty)
  }
}

function getSeries(cirty) {
  const data = []
  const num = [0, 0, 0, 0, 0, 0, 0]
  for (const item of cirty) {
    const obj = {
      name: item,
      type: 'bar',
      stack: '总量',
      barWidth: 16,
      data: roundData(num)
    }
    data.push(obj)
  }
   data.push({
   	  name: '总计',
      type: 'line',
      stack: '总量',
      data: num
   })
  return data
}

function roundData(num) {
  const arr = []
  for (let i = 0; i < 7; i++) {
  	const n = Math.floor(Math.random() * 50)
  	num[i] += n
    arr.push(n)
  }
  return arr
}
